package com.zycfc.zsf.boot.job.api.util;

import com.dangdang.ddframe.job.reg.zookeeper.*;
import com.zycfc.zsf.boot.core.common.*;
import java.util.concurrent.locks.*;
import com.dangdang.ddframe.job.reg.exception.*;
import org.slf4j.*;

public class ZsfJobRegisterUtils
{
    private static final Logger log;
    
    public static void persist(final String key, final String value, final int retryNm) {
        try {
            ((ZookeeperRegistryCenter)SpringContextHelper.getBean("zookeeperRegistryCenter", (Class)ZookeeperRegistryCenter.class)).persist(key, value);
        }
        catch (RegException e) {
            ZsfJobRegisterUtils.log.error("zsfJob: \u6301\u4e45\u5316persist\u64cd\u4f5cRegException\u5f02\u5e38, key[{}], value[{}], retryNm[{}]", new Object[] { key, value, retryNm });
            if (retryNm > 0) {
                ZsfJobRegisterUtils.log.info("zsfJob: \u6301\u4e45\u5316persist\u8865\u507f\uff0c\u963b\u585e2\u79d2\u540e\u91cd\u8bd5, key[{}], value[{}], retryNm[{}]", new Object[] { key, value, retryNm });
                LockSupport.parkNanos(2000000000L);
                persist(key, value, retryNm - 1);
            }
        }
    }
    
    static {
        log = LoggerFactory.getLogger((Class)ZsfJobRegisterUtils.class);
    }
}
